<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>滑箱特效</title>
  <!-- 滑箱特效 -->
  <style>
    button {
      outline: none;
      border: none;
      z-index: 1;
      position: relative;
      color: white;
      background: #40a9ff;
      padding: 0.5em 1em;
    }

    button::before {
      content: "";
      z-index: -1;
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      background-color: #fa541c;
      transform-origin: center bottom;
      transform: scaleY(0);
      transition: transform 0.4s ease-in-out;
    }

    button:hover {
      cursor: pointer;
    }

    button:hover::before {
      transform-origin: center top;
      transform: scaleY(1);
    }
  </style>
</head>

<body>
  <div>
    <button>滑箱特效</button>
  </div>
</body>

</html>